<template>
  <div id="app">
    <div :class="vueviews ? 'a-out-middle-button' : 'a-out-side-button'">
      <el-button id="appBtn" @click="clickChange" :class="vueviews ? 'a-middle-button' : 'a-side-button'" :circle="!vueviews"
        :icon="vueviews ? '' : 'el-icon-arrow-right'">{{ vueviews ? '切換' : '' }}</el-button>
    </div>
    <div class="com">
      <transition-group>
        <div :style="{ display: comA }" class="coma" key="1">
          <img alt="Vue logo" src="./assets/logo.png">
          <HelloWorld msg="Welcome to Your Vue.js App" />
        </div>
        <div :style="{ display: comB }" class="comb" key="2">
          <MetComponent />
        </div>
      </transition-group>
    </div>
  </div>
</template>

<script>
import HelloWorld from './components/HelloWorld.vue'
import MetComponent from './components/index.vue'

export default {
  name: 'App',
  data() {
    return {
      comA: 'block',
      comB: 'none',
      vueviews: true
    }
  },
  components: {
    HelloWorld,
    MetComponent
  },
  created(){
    this.clickChange()
  },
  methods: {
    clickChange() {
      this.vueviews = !this.vueviews
      const b = 'block'
      const n = 'none'
      this.comA = this.comB === b ? b : n
      this.comB = this.comA === b ? n : b
    }
  }
}
</script>
<style>
* {
  margin: 0;
  padding: 0;
}

html,
body,
#app {
  height: 100%;
  width: 100%;
}
</style>
<style lang="scss" scoped>
#app {
  font-family: Avenir, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-align: center;
  color: #2c3e50;

}

#appBtn {
  display: block;
  margin: auto;
}

.a-middle-button {}

.a-side-button {}

.a-out-side-button {
  position: fixed;
  left: -20px;
  top: 5px;
  z-index: 999;

  &:hover {
    left: 0px;
    transition: 0.5s;
  }
}</style>
